use snowflake_rs::SnowFlakeId;
use std::sync::Mutex;

lazy_static::lazy_static! {
    static ref SNOWFLAKE: Mutex<SnowFlakeId> = Mutex::new(SnowFlakeId::new(1, 1609459200000));
}

// 定义一个方法返回雪花id
pub fn snowflake_id() -> String {
    let mut snowflake = SNOWFLAKE.lock().unwrap();
    snowflake.generate_id().unwrap().to_string()
}